/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package utils;

import java.awt.geom.Rectangle2D;

/**
 *
 * @author trong_000
 */
public class Rectangle {

    public float x, y, w, h;

    public Rectangle() {
        x = y = w = h = 0;
    }

    public Rectangle(float x, float y, float w, float h) {
        this.x = x;
        this.y = y;
        this.w = w;
        this.h = h;
    }

    private Rectangle2D toRect() {
        return new Rectangle2D.Double(x,y,w,h);
    }
    
    public boolean isIntersect(Rectangle B) {
        return this.toRect().intersects(B.toRect());
    }
    
    @Override
    public String toString() {
        return "(" + x + "," + y + "," + w + "," + h + "," +")";
    }
}
